package com.dao;

import BaseDBEntity.DbProperties;
import org.apache.ibatis.annotations.Param;
import springmvc.common.CriteriaExample;

import java.util.List;
import java.util.Map;

public interface BaseDao {

	int deleteByPrimaryKeys(@Param("params") Map<String, Object> map, @Param("db") DbProperties dbProperties);

	int deleteAll(@Param("db") DbProperties dbProperties);

	int deleteList(@Param("params") Map<String, Object> map, @Param("db") DbProperties dbProperties);

	int getCount(@Param("db") DbProperties dbProperties);

	int insert(@Param("params") Map<String, Object> map, @Param("db") DbProperties dbProperties);

	int insertSelective(@Param("params") Map<String, Object> map, @Param("db") DbProperties dbProperties);

	int updateByPrimaryKeys(@Param("params") Map<String, Object> map, @Param("db") DbProperties dbProperties);

	int updateByPrimaryKeysSelective(@Param("params") Map<String, Object> map, @Param("db") DbProperties dbProperties);

	/*
	 * int updateBySelectivePrimaryKey(@Param("params") Map<String, Object> map,
	 * 
	 * @Param("db") DbProperties dbProperties);
	 */

	List<Map<String, Object>> selectAll(@Param("db") DbProperties dbProperties);

	/*
	 * 
	 * 有些主键是符合的，如果输入主键不全，返回的就是多个
	 */
	List<Map<String, Object>> selectByPrimaryKeysToList(@Param("params") Map<String, Object> map,
			@Param("db") DbProperties dbProperties);

	List<Map<String, Object>> queryList(@Param("params") Map<String, Object> map,
			@Param("db") DbProperties dbProperties);

	/*
	 * 
	 * 有些主键是符合的，只返回一个
	 */
	Map<String, Object> selectByPrimaryKeysToOne(@Param("params") Map<String, Object> map,
			@Param("db") DbProperties dbProperties);

	List<Map<String, Object>> selectByCriteria(@Param("criteriaList") CriteriaExample criteriaList,
			@Param("db") DbProperties dbProperties);

	int updateByCriteria(@Param("criteriaList") CriteriaExample criteriaList, @Param("db") DbProperties dbProperties,
			@Param("params") Map<String, Object> map);

	int deleteByCriteria(@Param("criteriaList") CriteriaExample criteriaList, @Param("db") DbProperties dbProperties);

	int getCountByCriteria(@Param("criteriaList") CriteriaExample criteriaList, @Param("db") DbProperties dbProperties);

	int batchInsert(@Param("list") List<Map<String, Object>> map, @Param("db") DbProperties dbProperties);

	int batchUpdate(@Param("list") List<Map<String, Object>> map, @Param("db") DbProperties dbProperties);

}
